package com.genexususa.eo.bing.data.results;

import com.genexususa.eo.bing.CampaignManagementServiceClasses.BatchError;
import com.genexususa.eo.bing.CampaignManagementServiceClasses.EditorialError;
import com.genexususa.eo.bing.data.GxItemException;

import javax.xml.bind.annotation.*;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Bing_TargetIdCampaignIdResults")
public class GxTargetIdCampaignIdResults extends GxGeneralResults {
    @XmlElementWrapper(name = "TargetIdCampaignIdResultCollection")
    @XmlElement(name = "TargetIdCampaignIdResult")
    public GxTargetIdCampaignIdResult[] targetIdCampaignIdResultCollection;

    public GxTargetIdCampaignIdResults() {
        super();
    }

    public GxTargetIdCampaignIdResults(int resultQuantity) {
        super();
        this.targetIdCampaignIdResultCollection = new GxTargetIdCampaignIdResult[resultQuantity];
    }

    public void addResult(int index, GxTargetIdCampaignIdResult trackingIdResult) {
        this.targetIdCampaignIdResultCollection[index] = trackingIdResult;
    }

    public void addGxExceptionError(GxItemException error, int index) {
        this.targetIdCampaignIdResultCollection[index].addGxExceptionError(error, index);
    }

    public void addBatchError(BatchError error) {
        this.targetIdCampaignIdResultCollection[error.getIndex()].addBatchError(error);
    }

    public void addEditorialError(EditorialError error) {
        this.targetIdCampaignIdResultCollection[error.getIndex()].addEditorialError(error);
    }

    public GxTargetIdCampaignIdResult[] getTargetIdCampaignIdResultCollection() {
        return targetIdCampaignIdResultCollection;
    }

    public void setError() {
        this.hasError = true;
    }
}
